#include "File.h"

namespace GPUCC
{
	File::File(const std::string& Path) : m_Path(Path)
	{
	}

	File::~File()
	{
	}

	unsigned int File::GetSize()
	{
		unsigned int Size = FileDetails::MAX_FILE_SIZE;
		
		bool WasOpen = this->IsOpen();
		unsigned int Opened = true;

		if (!WasOpen)
		{
			Opened = this->Open(true);
		}

		if (Opened)
		{
			Size = this->GetSizeInternal();

			if (!WasOpen)
			{
				this->Close();
			}
		}

		return (Size);
	}

	std::string File::GetPath()
	{
		return (this->m_Path);
	}

	void File::SetPath(const std::string& Path)
	{
		this->m_Path = Path;
	}

	FileDetails File::GetDetails()
	{
		return (FileDetails(this->m_Path, this->GetSize()));
	}
}